home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
clipper
/
nftroff.zip
/
2.tr
< prev
next >
Wrap
Text File
|
1991-11-21
|
16KB
|
1,064 lines
.de }n
.bp
.sp .5i
..
.wh -.8i }n
.sp .5i
.po -.4i
.ll 7.5i
.ps 9
.vs 9
.in 0i
.ta 1.63265i
.sp 2
.ne 20
.ps +3
.vs +3
FT_BYT2BIT() Convert byte to string of 1\'s and 0\'s
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_BYT2BIT()
Convert byte to string of 1\'s and 0\'s
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.4i
\fBFT_BYT2BIT( <cByte> ) -> cBitPattern
.sp
.in 0.08i
\fBArguments
.sp
.in 0.4i
\fB<cByte>\fR is the byte to convert\.
.sp
.in 0.08i
\fBReturns
.sp
.in 0.4i
9-character string, consisting of 1\'s and 0\'s, representing bits 0
through 7 of parameter byte, with space between bits 3 and 4\. Returns
NIL if parameters are faulty\.
.sp
.in 0.08i
\fBDescription
.sp
.in 0.4i
Can be used to show results of bit manipulation, both before and after\.
Binary representation follows right-to-left convention of bit position
numbering, 0 through 7\. Space between high and low nibbles for clarity
and easy comparison to hexadecimal notation\.
.sp
This function is presented to illustrate that bit-wise operations
are possible with Clipper code\. For greater speed, write \.C or
\.ASM versions and use the Clipper Extend system\.
.sp
.in 0.08i
\fBExamples
.sp
.in 0.4i
These three code lines perform a bitwise AND on bytes with values of
CHR(20) and CHR(36), and deliver the result as a string in binary (bit)
format\.
.sp
.in 0.8i
.ta 2.4i
? FT_BYT2BIT(CHR(20)) // byte1: \'0001 0100\'
.br
.ta
.ta 2.4i
? FT_BYT2BIT(CHR(36)) // byte2: \'0010 0100\'
.br
.ta
.sp
? FT_BYT2BIT(FT_BYTEAND(CHR(20), CHR(36)))
.in 2.32i
// result: \'0000 0100\'
.sp
.in 0.4i
For a demonstration of Clipper bit manipulations, compile and
link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
.sp
.in 0.08i
\fBSource:\fR BYT2BIT\.PRG
.sp
\fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
.in 0i
.sp
.in 1.5i
.ti -1.5i
.ta 1.5i
.ft B
See Also:
.ft R
FT_BYT2HEX()
.ta 1.63265i
.in 0i
.sp 2
.ne 20
.ps +3
.vs +3
FT_BYT2HEX() Convert byte to hexadecimal version of its binary value
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_BYT2HEX()
Convert byte to hexadecimal version of its binary value
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.4i
\fBFT_BYT2HEX( cByte ) -> cHexValue
.sp
.in 0.08i
\fBArguments
.sp
.in 0.4i
\fB<cByte>\fR is the byte to convert\.
.sp
.in 0.08i
\fBReturns
.sp
.in 0.4i
Three-character string, consisting of two digits of hexadecimal
notation and letter \'h\' to signify hex\. Returns NIL if parameters are
faulty\.
.sp
.in 0.08i
\fBDescription
.sp
.in 0.4i
Can be used to show results of bit manipulation, both before and after\.
.sp
This function is presented to illustrate that bit-wise operations
are possible with Clipper code\. For greater speed, write \.C or
\.ASM versions and use the Clipper Extend system\.
.sp
.in 0.08i
\fBExamples
.sp
.in 0.4i
These three code lines perform a bitwise AND on bytes with values of
CHR(20) and CHR(36), and deliver the result as a string in hexadecimal
format, using \'h\' to signify hexadecimal\.
.sp
.in 0.8i
.ta 2.4i
? FT_BYT2HEX(CHR(20)) // byte1: \'14h\'
.br
.ta
.ta 2.4i
? FT_BYT2HEX(CHR(36)) // byte2: \'24h\'
.br
.ta
.sp
? FT_BYT2HEX(FT_BYTEAND(CHR(20), CHR(36)))
.in 2.32i
// result: \'04h\'
.sp
.in 0.4i
For a demonstration of Clipper bit manipulations, compile and
link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
.sp
.in 0.08i
\fBSource:\fR BYT2HEX\.PRG
.sp
\fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
.in 0i
.sp
.in 1.5i
.ti -1.5i
.ta 1.5i
.ft B
See Also:
.ft R
FT_BYT2BIT()
.ta 1.63265i
.in 0i
.sp 2
.ne 20
.ps +3
.vs +3
FT_D2E() Convert decimal to scientific notation
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_D2E()
Convert decimal to scientific notation
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.96i
.ta 2.56i
\fBFT_D2E( <nDec>, <nPrecision> ) -> <cNumE>
.br
.ta
.sp
.in 0.08i
\fBArguments
.sp
.in 1.28i
.ta 1.2i
\fB<nDec>\fR Decimal number to convert
.br
.ta
.sp
.ta 1.2i
\fB<nPrecision>\fR Number of decimal places in result\.
.br
.ta
.in 1.68i
Defaults to 6 decimal places\.
.sp
.in 0.08i
\fBReturns
.sp
.in 1.28i
.ta 1.2i
<cNumE> A string representing a number in
.br
.ta
.in 1.68i
scientific notation
.sp
.in 0.08i
\fBDescription
.sp
.in 1.28i
Given a decimal number and the desired precision,
a string representing the equivalent in scientific
notation is returned\.
.sp
.in 0.08i
\fBExamples
.sp
.in 1.28i
? FT_D2E( 12\.345, 2 )
.in 1.44i
-> 1\.23E1
.sp
.in 1.28i
? FT_D2E( -12\.345, 3 )
.in 1.44i
-> -1\.235E1
.sp
.in 1.28i
? FT_D2E( 0\.00000543, 2 )
.in 1.44i
-> 5\.43E-6
.sp
.in 0.08i
\fBSource:\fR D2E\.PRG
.sp
\fBAuthor:\fR Gary Baren
.in 0i
.sp
.in 1.5i
.ti -1.5i
.ta 1.5i
.ft B
See Also:
.ft R
FT_E2D()
.ta 1.63265i
.in 0i
.sp 2
.ne 20
.ps +3
.vs +3
FT_DEC2BIN() Convert decimal to binary
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_DEC2BIN()
Convert decimal to binary
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.4i
\fBFT_DEC2BIN( <nNum> ) -> cBinaryNumber
.sp
.in 0.08i
\fBArguments
.sp
.in 0.4i
\fB<nNum>\fR is the numeric expression to be converted\.
.sp
.in 0.08i
\fBReturns
.sp
.in 0.4i
A character string representing <nNum> in binary format\.
.sp
.in 0.08i
\fBDescription
.sp
.in 0.4i
This function can be used in conjunction with any bit-wise
operations\.
.sp
.in 0.08i
\fBExamples
.sp
.in 0.4i
.ta 2.48i
QOut( FT_DEC2BIN(255) ) // "11111111"
.br
.ta
.ta 2.48i
QOut( FT_DEC2BIN(2) ) // "00000010"
.br
.ta
.sp
.in 0.08i
\fBSource:\fR DECTOBIN\.PRG
.sp
\fBAuthor:\fR Greg Lief
.in 0i
.ta 1.63265i
.sp 2
.ne 20
.ps +3
.vs +3
FT_E2D() Convert scientific notation string to a decimal
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_E2D()
Convert scientific notation string to a decimal
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.96i
.ta 1.52i
\fBFT_E2D( <cNumE> ) -> <nDec>
.br
.ta
.sp
.in 0.08i
\fBArguments
.sp
.in 1.28i
.ta 0.8i
\fB<cNumE>\fR Scientific notation string to convert
.br
.ta
.sp
.in 0.08i
\fBReturns
.sp
.in 1.28i
.ta 0.8i
<nDec> Decimal number
.br
.ta
.sp
.in 0.08i
\fBDescription
.sp
.in 1.28i
.ta 2.4i
Given a string in the format x\.yEz, the decimal
.br
.ta
equivalent is returned\.
.sp
.in 0.08i
\fBExamples
.sp
.in 1.28i
? FT_E2D( "1\.23E1" )
.in 1.44i
-> 12\.3
.sp
.in 1.28i
? FT_E2D( "-1\.235E1" )
.in 1.44i
-> -12\.35
.sp
.in 1.28i
? ft_d2e( "5\.43E-6" )
.in 1.44i
-> 0\.0000543
.sp
.in 0.08i
\fBSource:\fR E2D\.PRG
.sp
\fBAuthor:\fR Gary Baren
.in 0i
.sp
.in 1.5i
.ti -1.5i
.ta 1.5i
.ft B
See Also:
.ft R
FT_D2E()
.ta 1.63265i
.in 0i
.sp 2
.ne 20
.ps +3
.vs +3
FT_ESCCODE() Convert Lotus style escape codes
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_ESCCODE()
Convert Lotus style escape codes
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.4i
.ta 1.92i
\fBFT_ESCCODE( <cASCII> ) -> <cPrinterFormat>
.br
.ta
.sp
.in 0.08i
\fBArguments
.sp
.in 0.4i
\fB<cASCII>\fR is the ASCII representation of the printer control
.in 1.28i
codes in Lotus 123 format (e\.g\. "\\027E" for Chr(27)+"E")
.sp
.br
"\\nnn" will be converted to Chr(nnn)
.br
"\\\\" will be converted to "\\"
.sp
.in 0.08i
\fBReturns
.sp
.in 0.4i
The binary version of an ASCII coded printer setup string\.
.sp
.in 0.08i
\fBDescription
.sp
.in 0.4i
This function is useful for allowing the user to enter printer
control codes in Lotus-style ASCII format, and then having
this function convert that code to the format that the printer
needs to receive\.
.sp
.in 0.08i
\fBExamples
.sp
.in 0.4i
.ta 2i
cSetup = "\\015" // default = Epson compressed print
.br
.ta
.ta 2i
UserInput( @cSetup ) // Let user modify setup code
.br
.ta
.ta 2i
SET DEVICE TO PRINT // get ready to print
.br
.ta
.ta 2i
?? FT_ESCCODE( cSetup ) // Output the converted code
.br
.ta
.sp
.in 0.08i
\fBSource:\fR PRTESC\.PRG
.sp
\fBAuthor:\fR Steven Tyrakowski
.in 0i
.ta 1.63265i
.sp 2
.ne 20
.ps +3
.vs +3
FT_HEX2DEC() Convert a hex number to decimal
.br
.ta
.in 0.08i
.ps -3
.vs -3
.sp 2
\fBFT_HEX2DEC()
Convert a hex number to decimal
.in 0i
.br
\l'6.24i'
.br
.sp
.in 0.08i
\fBSyntax
.sp
.in 0.32i
\fBFT_HEX2DEC( <cHexNum> ) -> nDecNum
.sp
.in 0.08i
\fBArguments
.sp
.in 0.32i
\fB<cHexNum>\fR is a character string representing a hex number\.
.sp
.in 0.08i
\fBReturns
.sp
.in 0.32i
A decimal number\.
.sp